$(function(){
    $(".nav1").mouseenter(function () {
        $(".braw-list-box1").css({ display: "block" })
    });
    $(".nav1").mouseleave(function () {
        $(".braw-list-box1").css({ display: "none" })
    });
    $(".nav2").mouseenter(function () {
        $(".braw-list-box2").css({ display: "block" })
    });
    $(".nav2").mouseleave(function () {
        $(".braw-list-box2").css({ display: "none" })
    });
    $(".nav3").mouseenter(function () {
        $(".braw-list-box3").css({ display: "block" })
    });
    $(".nav3").mouseleave(function () {
        $(".braw-list-box3").css({ display: "none" })
    });
    $(".nav5").mouseenter(function () {
        $(".braw-list-box5").css({ display: "block" })
    });
    $(".nav5").mouseleave(function () {
        $(".braw-list-box5").css({ display: "none" })
    });
    $(".list2").click(function () {
        $(".list2").css({ borderBottom: "2px solid #000" })
        $(".list1").css({ borderBottom: "none" })
    })
    $(".list1").click(function () {
        $(".list1").css({ borderBottom: "2px solid #000" })
        $(".list2").css({ borderBottom: "none" })
    })
    runtext();
    function runtext() {
        var index = 0;
        setInterval(function () {
            index++;
            $(".discount-list li").eq(index).css({ display: "block" }).siblings().css({ display: "none" });
            if (index > 1) {
                index = -1;
            }
        }, 2000);
    }
    
    
    var user1 = getCookie("lgc");
    if(user1){
        $(".tips").html("欢迎您," + getCookie("lgc") + "<button class='exit'>退出</button>");
        // var btn = tips.querySelector("button");

        $(".exit").click(function () {
            delCookie("lgc");
            location.reload();
            $(".tips").html("登录");
        })
        $(".shoppingcar").click(function () {
            location.href = "../html/shoppingcar.html";
        })

        $(document).on("click", ".addcar", function () {
            console.log($(".specs_num"));
            var buyNum = $(".specs_num").val();
            console.log(buyNum);
        })

    }else {
        $(".shoppingcar").click(function () {
            location.href = "../html/login.html?returnUrl=" + encodeURIComponent(location.href);

        })
        $(".tips").click(function () {
            location.href = "../html/login.html?returnUrl=" + encodeURIComponent(location.href);
        })

        
        $(document).on( "click",".addcar",function () {
            location.href = "../html/login.html?returnUrl=" + encodeURIComponent(location.href);
        })
    }
   

        
})